import Vue from 'vue'
import VueRouter from 'vue-router';

Vue.use(VueRouter)
import MainPage from "pages/MainPage"
import ShopCart from "pages/ShopCart"
import LoginPage from "pages/LoginPage"
import PhoneLogin from "pages/views/LoginPage/login/PhoneLogin"
import EmailLogin from "pages/views/LoginPage/login/EmailLogin"
import PasswordLogin from "pages/views/LoginPage/login/PasswordLogin"
import Register from "pages/views/LoginPage/register/Register"
import Search from "pages/Search"
import Error from "pages/Error"
import ProductList from "pages/views/product/ProductList"



const routes =  [
    {
        path: "/",
        redirect: "/mainPage"
    },
    {
        path: "/mainPage",
        component: MainPage
    },
    {
        path: "/shopcart",
        component: ShopCart
    },
    {
        path: "/plist",
        component: ProductList,
        name: "plist"
    },
    {
        path: "/login",
        component: LoginPage,
    },
    {
        path: "/phonelogin",
        component: PhoneLogin
    },
    {
        path: "/emaillogin",
        component: EmailLogin
    },
    {
        path: "/passwordlogin",
        component: PasswordLogin
    },
    {
        path: "/search",
        component: Search
    },
    {
        path: "/register",
        component: Register
    },
    {
        path: "/error",
        component: Error
    },  
     {
        path: "**",
        redirect: "/error"
    }
]

const router = new VueRouter({
    routes,
    mode: "history"
})

export default router
